//
//  SYJinXingTableViewCell.m
//  SanYiTeaching
//
//  Created by 郑浩然 on 2019/4/20.
//  Copyright © 2019年 SanYi. All rights reserved.
//

#import "SYJinXingTableViewCell.h"

@interface SYJinXingTableViewCell ()
@property (strong, nonatomic) UIButton *checkButton;//查看
@property (strong, nonatomic) UIButton *deleteBtn;//删除
@property (strong, nonatomic) UIButton *chakanBtn;//查看
@end


@implementation SYJinXingTableViewCell

- (void)initSubView {
    NSArray *xiaoArr = @[@"123456",@"关晓彤",@"女",@"13000000000",@"2019-01-30",@"听课",@"查看",@"移出"];
    CGFloat whit = (865*fw)/8;
    for (NSInteger i = 0; i < 8; i++) {
        if (i == 6) {//查看
            _checkButton = [UIButton buttonWithType:UIButtonTypeCustom];
            [_checkButton setImage:[UIImage imageNamed:@"sx_xiaozu_chakan"] forState:UIControlStateNormal];
            _checkButton.titleLabel.font = [UIFont systemFontOfSize:12];
            [_checkButton addTarget:self action:@selector(lookUp) forControlEvents:UIControlEventTouchUpInside];
            _checkButton.tag = 20+i;
            [self addSubview:_checkButton];
            [_checkButton mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.mas_left).offset(whit*i);
                make.top.equalTo(self.mas_top);
                make.width.mas_equalTo(whit);
                make.height.mas_equalTo(40);
            }];
        } else if (i == 7) {//移出
            _deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
            
            [_deleteBtn setImage:[UIImage imageNamed:@"sx_xiaozu_yichu"] forState:UIControlStateNormal];
            _deleteBtn.titleLabel.font = [UIFont systemFontOfSize:12];
            [_deleteBtn addTarget:self action:@selector(lookUp) forControlEvents:UIControlEventTouchUpInside];
            _deleteBtn.tag = 20+i;
            [self addSubview:_deleteBtn];
            [_deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.mas_left).offset(whit*i);
                make.top.equalTo(self.mas_top);
                make.width.mas_equalTo(whit);
                make.height.mas_equalTo(40);
            }];
        } else {
            UILabel *title = [UILabel titleColour:TITLECOLOR
                                       titleFount:14
                                         pingfang:@"PingFang-SC-Medium"
                                        alignment:NSTextAlignmentCenter
                                        titleLine:1];
            if (i == 5) {
                title.textColor = [UIColor colorWithHexString:@"#FF4800"];
            }
            title.tag = i;
            title.text = xiaoArr[i];
            [self addSubview:title];
            [title mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.mas_left).offset(whit*i);
                make.top.equalTo(self.mas_top);
                make.width.mas_equalTo(whit);
                make.height.mas_equalTo(40);
            }];
        }
        
        
        
    }
}

@end
